package com.guldan.jaina.provider;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.guldan.core.dubbo.client.ResponseDTO;
import com.guldan.core.search.Pagination;
import com.guldan.jaina.dto.citizenbank.CitizenBankDTO;
import com.guldan.jaina.dto.citizenbank.CitizenBankSearchDTO;
import com.guldan.jaina.manager.CitizenBankManager;

/**
 * Created by Silas.
 * Date: 2016/11/7
 * Time: 22:54
 */
@Component
public class CitizenBankProviderImpl implements ICitizenBankProvider {

    @Autowired
    private CitizenBankManager citizenBankManager;

    @Override
    public ResponseDTO<CitizenBankDTO> get(Integer areaId) {
        ResponseDTO<CitizenBankDTO> response = new ResponseDTO<>();
        response.setData(citizenBankManager.get(areaId));
        return response;
    }

    @Override
    public ResponseDTO<CitizenBankDTO> save(CitizenBankDTO dto) {
        ResponseDTO<CitizenBankDTO> response = new ResponseDTO<>();
        response.setData(citizenBankManager.save(dto));
        return response;
    }

    @Override
    public ResponseDTO<Boolean> delete(Integer areaId) {
        ResponseDTO<Boolean> response = new ResponseDTO<>();
        response.setData(citizenBankManager.delete(areaId));
        return response;
    }

    @Override
    public ResponseDTO<Pagination<CitizenBankDTO>> list(CitizenBankSearchDTO citizenBankSearchDTO) {
        ResponseDTO<Pagination<CitizenBankDTO>> response = new ResponseDTO<>();
        response.setData(citizenBankManager.list(citizenBankSearchDTO));
        return response;
    }

}
